﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 依赖倒置原则._1
{
    /// <summary>
    /// 重复代码很多， Singer作为高层模块，严重依赖底层模块 不符合依赖倒置原则，开放封闭原则 -单一职责原则
    /// </summary>
    public class Singer
    {
        public void SingSong(ChineseSong chineseSong)
        {
            Console.WriteLine($"歌手正在唱{chineseSong.GetSongWords()}");
        }
        public void SingSongEnglish(EnglishSong englishSong)
        {
            Console.WriteLine($"歌手正在唱{englishSong.GetSongWords()}");
        }
    }

    public class ChineseSong
    { 
    public string GetSongWords()
        {
            return "中国歌曲";
        }
    }
    public class EnglishSong
    {
        public string GetSongWords()
        {
            return "外国歌曲";
        }
    }
}
